{extend name="public/base"/}
{block name="body"}
<style type="text/css">
	.attrs{margin-top:5px;}
	.attrname{width:100px;border:solid 1px #ddd;height:31px;font-size:14px;padding-left:4px;}
	.attrval{width:40%;border:solid 1px #ddd;height:31px;font-size:14px;padding-left:4px;}
</style>
<title>编辑总部与分部</title>
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal section" id="form-admin-add">
		<section>
			<input type="hidden" class="input-text" value="{$data.id}" id="id" name="id">

			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">名称：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.company_name}" placeholder="名称" id="company_name" name="company_name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">地址：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.company_address}" placeholder="地址" id="company_address" name="company_address">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">站点：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.site_url}" placeholder="站点" id="site_url" name="site_url">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">电话：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.phone}" placeholder="电话" id="phone" name="phone">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">Email：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.email}" placeholder="Email" id="email" name="email">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">服务热线：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.tel}" placeholder="服务热线" id="tel" name="tel">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">排序：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="number" class="input-text" value="{$data.sort}" placeholder="0" id="sort" name="sort">
				</div>
			</div>

		</section>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input id="submit" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$("#submit").click(function() {
	layer.load(1, {
	  shade: [0.1,'#fff'] //0.1透明度的白色背景
	});
	var id=$("input[name=id]").val();
	var company_name=$("input[name=company_name]").val();
	var company_address=$("input[name=company_address]").val();
	var site_url=$("input[name=site_url]").val();
	var tel=$("input[name=tel]").val();
	var email=$("input[name=email]").val();
	var phone=$("input[name=phone]").val();
	var sort=$("input[name=sort]").val();
		$.ajax({
		    type: 'POST',
		    url: "{:url('headquarters_branches_edit')}",
		    data: {id:id,tel:tel,site_url:site_url,company_address:company_address,company_name:company_name,email:email,phone:phone,sort:sort},
		    success: function(resdata){
		        if(resdata.code==200){
					layer.msg(resdata.msg,{icon:1,time:1000});
					setTimeout("parent.location.reload()",1000);
		        }else{
					layer.msg(resdata.msg,{icon:2,time:3000});
		        }
		    },
		    error: function(){
				layer.msg('数据保存失败',{icon:2,time:3000});
		    }
		})
	
})
</script> 
{/block}